<?php
/**
 * Created by PhpStorm.
 * User: jason
 * Date: 2017/12/12
 * Time: 0:56
 */

namespace Home\Service;


use Think\Model;

class MemberSheetViewListService extends Model
{
    public function add($userId, $sheetId)
    {
        $map = [
            'user_id' => $userId,
            'sheet_id' => $sheetId
        ];
        $res = M('MemberSheetViewList')->where($map)->find();
        if ($res) {
            return false;
        }
        try {
            $data = [
                'user_id' => $userId,
                'sheet_id' => $sheetId,
                'create_time' => time()
            ];
            $id = M('MemberSheetViewList')->add($data);
            return $id;
        } catch (\Exception $e) {
            $this->error = '添加失败';
            return false;
        }


    }
}